<template>
  <j-modal
    :title="title"
    :width="1200"
    :visible="visible"
    :maskClosable="false"
    :fullscreen="true"
    switchFullscreen
    @ok="handleOk"
    :okButtonProps="{ class: { 'jee-hidden': disableSubmit } }"
    @cancel="handleCancel"
  >
    <tsl-pro-package-pick-bill-form
      ref="realForm"
      @ok="submitCallback"
      :disabled="disableSubmit"
      :billType="billType"
    />
  </j-modal>
</template>

<script>
import TslProPackagePickBillForm from './TslProPackagePickBillForm'

export default {
  name: 'TslProPackagePickBillModal',
  components: {
    TslProPackagePickBillForm,
  },
  data() {
    return {
      title: '',
      billType: 'MANUAL',
      width: 800,
      visible: false,
      disableSubmit: false,
    }
  },
  methods: {
    add(rows, packshopCode) {
      this.visible = true
      this.$nextTick(() => {
        this.$refs.realForm.add(rows, packshopCode)
      })
    },
    edit(record) {
      this.visible = true
      this.$nextTick(() => {
        this.$refs.realForm.edit(record)
      })
    },
    close() {
      this.$emit('close')
      this.visible = false
    },
    handleOk() {
      this.$refs.realForm.handleOk()
    },
    submitCallback() {
      this.$emit('ok')
      this.visible = false
    },
    handleCancel() {
      this.close()
    },
  },
}
</script>

<style scoped></style>
